package bancosys.tec.persist.hibernate.domain;

import java.io.Serializable;
import java.util.Iterator;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Transient;

import jmine.tec.persist.annotation.Alias;
import bancosys.tec.persist.Persistable;
import bancosys.tec.persist.authorization.Authorizable;
import bancosys.tec.persist.authorization.AuthorizationContext;
import bancosys.tec.persist.authorization.AuthorizationMode;
import bancosys.tec.persist.authorization.Authorizer;
import bancosys.tec.persist.controller.PersistenceEnabledController;
import bancosys.tec.persist.persister.PersistenceAction;
import bancosys.tec.persist.persister.Persister;
import bancosys.tec.utils.date.Timestamp;

@Entity
@Alias("ANTENT")
public class AnnotatedEntity implements Authorizable {
    private Long id;

    private Long authId;

    private String name;

    private Boolean auth;

    private boolean dirty = false;

    public AnnotatedEntity() {
        this.id = null;
        this.name = "name " + this.id;
    }

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    public Long getId() {
        return this.id;
    }

    protected void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "[" + this.id + ", " + this.name + "]";
    }

    /**
     * Testa se o objeto está dirty.
     * 
     * @return <code>true</code> caso esteja, <code>false</code> caso contrário.
     */
    public boolean isDirty() {
        return this.dirty;
    }

    /**
     * Define se o objeto está dirty ou não.
     * 
     * @param flag indicando se o objeto está dirty ou não.
     */
    public void setDirty(boolean flag) {
        this.dirty = flag;
    }

    @Transient
    public Iterator<?> getDetail(Class<?> arg0) {
        return null;
    }

    @Transient
    public long getAuditTrailID() {
        return 0;
    }

    @Transient
    public String getAuthActionString() {
        return null;
    }

    @Transient
    public Authorizer<?> getAuthorizer() {
        return null;
    }

    @Transient
    public PersistenceAction getPersistenceAction() {
        return null;
    }

    @Transient
    public String getModule() {
        return null;
    }

    @Transient
    public Timestamp getTimeStamp() {
        return null;
    }

    @Transient
    public String getUser() {
        return null;
    }

    @Transient
    public void setAuditTrailID(long id) {

    }

    @Transient
    public void setPersistenceAction(PersistenceAction commandType) {

    }

    @Transient
    public void setModule(String module) {

    }

    @Transient
    public void setTimeStamp(Timestamp timeStamp) {

    }

    @Transient
    public void setUser(String user) {

    }

    @Transient
    public PersistenceEnabledController getController() {
        return null;
    }

    @Transient
    public Persister<? extends Persistable> getPersister() {
        return null;
    }

    @Transient
    public Persister<? extends Persistable> getPurePersister() {
        return null;
    }

    @Transient
    public void setController(PersistenceEnabledController persistenceEnabledController) {

    }

    @Transient
    public AuthorizationContext getAssociatedPartition() {
        return null;
    }

    @Transient
    public boolean realizeLazyAssociations() {
        return false;
    }

    @Transient
    public void setAssociatedPartition(AuthorizationContext partition) {

    }

    public Serializable getAuthId() {
        return this.authId;
    }

    public void setAuthId(Serializable authId) {
        this.authId = (Long) authId;
    }

    public Boolean getAuth() {
        return this.auth;
    }

    public void setAuth(Boolean auth) {
        this.auth = auth;
    }

    public Serializable getPk() {
        return this.id;
    }

    public void setPk(Serializable pk) {
        this.id = (Long) pk;
    }

    public String identification() {
        return this.getPk().toString();
    }

    @Transient
    public AuthorizationMode getAuthorizationMode(Object action) {
        return null;
    }
}
